fix(ui): fix flash between home and new chat#4143
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
PR SummaryLow Risk Overview When the first Reviewed by Cursor Bugbot for commit 5ae0b42. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5ae0b42. Configure here.
Greptile SummaryReplaces The Confidence Score: 5/5Safe to merge — the fix is correct and the only remaining finding is dead-code cleanup (P2). The core change (using window.history.replaceState instead of router navigation) correctly eliminates the flash with no functional regression. The only open finding is an unused router variable/import left over from the refactor, which does not affect runtime behavior. apps/sim/app/workspace/[workspaceId]/home/hooks/use-chat.ts — minor cleanup of unused router/useRouter. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant HomeChat as useChat (home)
participant API as Mothership API
participant BrowserHistory as window.history
User->>HomeChat: sendMessage()
HomeChat->>API: POST /api/mothership/chat
API-->>HomeChat: SSE session event (chatId assigned)
HomeChat->>BrowserHistory: replaceState(null, '', /workspace/{id}/task/{chatId})
Note over HomeChat,BrowserHistory: URL silently updated — no Next.js route change, no flash
API-->>HomeChat: SSE text/tool events
HomeChat->>HomeChat: setMessages(), setResolvedChatId()
|

Summary
Switching nextjs routes causes a brief flash. Reverted to directly modifying url instead of changing nextjs state.
Type of Change
Testing
Checklist
Screenshots/Videos